package {
	import flash.display.Sprite;
	import flash.display.Bitmap;
	

	public class Ari extends Sprite {
		private var colls:Array = new Array();
		[Embed(source='../assets/ariD.png')]
		private var Image:Class;
		private var myImg:Sprite;
		private var myAura:Sprite;
		private var radiusAura:uint = 1.7*ScreenGame.PIXEL_SIZE;
		
		public function Ari() {
			drawAri();
			drawAura(radiusAura);
			addColisioners();
		}
		private function addColisioners():void{
			const k:uint = 77;
			for (var i:Number = 0; i < 2*Math.PI ; i += Math.PI/2){
				var	col:Sprite = new Sprite();
				col.graphics.beginFill(0xff0000);
				var xPos:Number = myImg.width/2*Math.cos(i);
				var yPos:Number = -myImg.height/2*Math.sin(i);
				var w:Number = Math
				.abs((myImg.width-k)*Math.sin(i)) + 5;
				var h:Number = Math.abs((myImg.height-k)*-Math.cos(i)) + 5;
				col.graphics.drawRect(xPos-w/2,yPos - h/2, w, h);
				col.graphics.endFill();
				addChild(col);
				colls.push(col);
				col.visible = false;
				
			}
		}
		public function drawAura(radioA:uint):void{
			
			myAura = new Sprite;
			myAura.graphics.beginFill(0x00ff00);
			myAura.graphics.drawCircle(0, 0, radioA);
			addChild(myAura);
		}
		private function drawAri():void{
			var myBitmap:Bitmap;
			myBitmap = new Image();
			myBitmap.x = -myBitmap.width/2;
			myBitmap.y = -myBitmap.height/2;
			myImg = new Sprite();
			myImg.addChild(myBitmap);
			addChild(myImg);
		}
					
		public function get coll():Array{
			return colls;
		}
		public function get img():Sprite{
			return myImg;
		}
		public function set img(value:Sprite):void{
			myImg = value;
		}
		public function get aura():Sprite{
			return myAura;
		}
		public function set aura(value:Sprite):void{
			myAura = value;
		}
		public function get radio():uint{
			return radiusAura;
		}
		public function set radio(value:uint):void{
			radiusAura = value;
		}
	}
}
